package dilmaj.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.PopupPanel;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.VerticalPanel;

import dilmaj.client.AddAreasPanel.CloseHandler;
import dilmaj.shared.TermVO;

public class MessagePanel extends PopupPanel {
	VerticalPanel mainPanel=new VerticalPanel();
	Label messageLabel=new Label();
	Button closeButton=new Button("Close");

	public MessagePanel(String message) {
		CloseHandler closeHandler=new CloseHandler(this);
		closeButton.addClickHandler(closeHandler);
		mainPanel.add(messageLabel);
		mainPanel.add(closeButton);

		messageLabel.setText(message);
				
		add(mainPanel);
	}
	
	class CloseHandler implements ClickHandler {
		private MessagePanel owner;
		
		public CloseHandler(MessagePanel owner) {
			this.owner=owner;
		}
		
		public void onClick(ClickEvent event) {
			owner.hide();
		}
	}
	
	AsyncCallback<TermVO> updateCallback = new AsyncCallback<TermVO>() {
		public void onFailure(Throwable caught) {
			        // TODO: Do something with errors.
		}
	
		public void onSuccess(TermVO result) {
		}
	};
}
